# %matplotlib inline
from nuscenes.nuscenes import NuScenes

#初始化
nusc = NuScenes(version='v1.0-mini', dataroot='/home/yyj/dl_dataset/nuscenes', verbose=True)

#!nuscenes 数据集每个scene 是一段20s的场景
# nusc.list_scenes()
my_scene = nusc.scene[0]
my_sample = nusc.sample[10]

sensor = 'CAM_FRONT'
cam_front_data = nusc.get('sample_data', my_sample['data'][sensor])
# print(cam_front_data['calibrated_sensor_token'])
calibrated_sensor = nusc.get('calibrated_sensor',cam_front_data['calibrated_sensor_token'])
#render 会将原始数据以及标注同时标出 
# nusc.render_sample_data(cam_front_data['token']) #只展示当前传感器的数据
# print(calibrated_sensor_token)
sensor = nusc.get("sensor",calibrated_sensor['sensor_token']) #{'token': '725903f5b62f56118f4094b46a4470d8', 'channel': 'CAM_FRONT', 'modality': 'camera'}
print(sensor)